package com.yykj.tencent.im.server.bean.message;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yykj.tencent.im.client.message.MsgType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 文件消息元素
 *
 */
@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TIMFileMsgElement extends TIMMsgElement {
    @JsonProperty("MsgContent")
    private FileMsgContent msgContent;

    public TIMFileMsgElement(FileMsgContent msgContent) {
        super(MsgType.TIM_FILE_ELEM);
        this.msgContent = msgContent;
    }

    public TIMFileMsgElement(String url, String uuid, Integer fileSize, String filename, Integer downloadFlag) {
        this(new FileMsgContent(url, uuid, fileSize, filename, downloadFlag));
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class FileMsgContent {
        @JsonProperty("Url")
        private String url;

        @JsonProperty("UUID")
        private String uuid;

        @JsonProperty("FileSize")
        private Integer fileSize;

        @JsonProperty("FileName")
        private String filename;

        @JsonProperty("Download_Flag")
        private Integer downloadFlag;

    }
}
